import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeadRelationVO, DeadRelationForm, DeadRelationQuery } from '@/api/cemetery/deadRelation/types';

/**
 * 查询逝者与家属关系列表
 * @param query
 * @returns {*}
 */

export const listDeadRelation = (query?: DeadRelationQuery): AxiosPromise<DeadRelationVO[]> => {
  return request({
    url: '/cemetery/deadRelation/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询逝者与家属关系详细
 * @param id
 */
export const getDeadRelation = (id: string | number): AxiosPromise<DeadRelationVO> => {
  return request({
    url: '/cemetery/deadRelation/' + id,
    method: 'get'
  });
};

/**
 * 新增逝者与家属关系
 * @param data
 */
export const addDeadRelation = (data: DeadRelationForm) => {
  return request({
    url: '/cemetery/deadRelation',
    method: 'post',
    data: data
  });
};

/**
 * 修改逝者与家属关系
 * @param data
 */
export const updateDeadRelation = (data: DeadRelationForm) => {
  return request({
    url: '/cemetery/deadRelation',
    method: 'put',
    data: data
  });
};

/**
 * 删除逝者与家属关系
 * @param id
 */
export const delDeadRelation = (id: string | number | Array<string | number>) => {
  return request({
    url: '/cemetery/deadRelation/' + id,
    method: 'delete'
  });
};
